package bz.yfw.example.s3blazeds.part2.helper
{
	import bz.yfw.example.s3blazeds.part2.model.ro.EmpRemotoObject;
	import bz.yfw.example.s3blazeds.part2.model.view.EmpViewModel;
	import bz.yfw.example.s3blazeds.part2.view.EmpEditSecondView;
	
	import org.seasar.akabana.yui.framework.ns.viewpart;
	
	import spark.components.TextArea;
	import spark.components.TextInput;
	import spark.components.supportClasses.ViewReturnObject;
	
	use namespace viewpart;
	
	/**
	 * 社員編集2Helper
	 * @author tokufxug http://twitter.com/tokufxug
	 */ 
	public class EmpEditSecondBackHelper
	{
		public var view:EmpEditSecondView;
		
		viewpart var txtarAddress:TextArea;
		
		viewpart var txtinptTelL:TextInput;
		
		viewpart var txtinptTelC:TextInput;
		
		viewpart var txtinptTelR:TextInput;
		
		viewpart var txtinptEmailL:TextInput;
		
		viewpart var txtinptEmailR:TextInput;
		
		
		public function get empViewModel():EmpViewModel {
			
			// 戻る -> 次へボタン押下後の復元情報 
			if (view.data && view.data is EmpViewModel) {
				return view.data as EmpViewModel;
			}
			return null;
		}
				
		public function moveBack(isSystem:Boolean = false):void {
			// 入力状態の復元を行うため、入力情報をViewModelに設定
			var vm:EmpViewModel = empViewModel;
			vm.address = txtarAddress.text;
			vm.telL = txtinptTelL.text;
			vm.telC = txtinptTelC.text;
			vm.telR = txtinptTelR.text;
			vm.emailL = txtinptEmailL.text;
			vm.emailR = txtinptEmailR.text;
			
			if (!isSystem) {
				view.navigator.popView();
			}
		}
	}
}